<!-- 左侧菜单栏 -->
<section class="sidebar">
    <!-- 管理员信息 -->
    <div class="user-panel hidden-xs">
        <div class="pull-left image">
            <a href="general/profile" class="addtabsit"><img src="{$admin.avatar|cdnurl|htmlentities}" class="img-circle" /></a>
        </div>
        <div class="pull-left info">
            <p>{$admin.nickname|htmlentities}</p>
            <i class="fa fa-circle text-success"></i> {:__('Online')}
        </div>
    </div>

    <!-- 菜单搜索 -->
    <form action="" method="get" class="sidebar-form" onsubmit="return false;">
        <!-- <div class="input-group">
            <input type="text" name="q" class="form-control" placeholder="{:__('Search menu')}">
            <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
            </span>
            <div class="menuresult list-group sidebar-form hide">
            </div>
        </div> -->
        <a href="javascript:;" class="btn btn-default {:config('site.syn_datetime_switch')!=1?'hidden':''}" style="font-size:13px;color:#FFF;">
            <span class="extend">
                	系统时间：<span id="current-time">{:date('Y/m/d H:i:s',time())}</span>
            </span>
        </a>
        <a href="javascript:;" class="btn btn-default {:config('site.syn_datetime_switch')!=1?'hidden':''}" style="font-size:13px;color:dodgerblue;">
            <span class="extend">
                	同步时间：<span id="syn-time"></span>
            </span>
        </a>
    </form>

    <!-- 移动端一级菜单 -->
    <div class="mobilenav visible-xs">

    </div>

    <!-- 左侧菜单栏 -->
    <ul class="sidebar-menu {if $Think.config.fastadmin.show_submenu}show-submenu{/if}">

        <!-- 菜单可以在 后台管理->权限管理->菜单规则 中进行增删改排序 -->
        {$menulist}

    </ul>
</section>

{if config('site.syn_datetime_switch')==1}
<script>
    // 使用 JavaScript 实现动态刷新秒数
    setInterval(function() {
    	var currentElement = document.getElementById("current-time");
    	var synElement = document.getElementById("syn-time");
        var currentTime = currentElement.innerText;
        var newTime = new Date(currentTime);
        newTime.setSeconds(newTime.getSeconds() + 1);

        // 格式化时间为 "年-月-日 时:分:秒"
        var formattedTime = newTime.getFullYear() + '-' +
                            ('0' + (newTime.getMonth() + 1)).slice(-2) + '-' +
                            ('0' + newTime.getDate()).slice(-2) + ' ' +
                            ('0' + newTime.getHours()).slice(-2) + ':' +
                            ('0' + newTime.getMinutes()).slice(-2) + ':' +
                            ('0' + newTime.getSeconds()).slice(-2);

        currentElement.innerText = formattedTime;
        
        var xhr = new XMLHttpRequest();
        xhr.open('GET', '/uploads/data/syn_datetime.json', true);
        xhr.onload = function() {
            if (xhr.readyState === 4 && xhr.status === 200) {
                var json = JSON.parse(xhr.responseText);
                synElement.innerText = json.datetime
            }
        };
        xhr.send();
    }, 1000);
</script>
{/if}